<template>
  <div>
    <h2>申请借款金额</h2>
    {{ from.tmoney }}
    <div>
      <br/>
      <van-row>
        <van-col span="8"></van-col>
        <van-col span="8">
          <van-cell-group>
            <van-field v-model="from.tmoney" label="出借" placeholder="请输入借款金额"></van-field>
          </van-cell-group>
          <van-slider v-model="from.tmoney" :min="2000" :max="300000" :step="100" />
        </van-col>
        <van-col span="8"></van-col>
      </van-row>

      <van-row><br><br>
        <van-col span="8"></van-col>
        <van-col span="8">
          <van-form>
            <van-field v-model="from.descrip" name="描述" label="描述" placeholder="描述"
              :rules="[{ required: true, message: '请填写描述' }]" />
            <van-field v-model="from.purpose" type="text" name="借款用途" label="借款用途" placeholder="借款用途"
              :rules="[{ required: true, message: '请填写借款用途' }]" />
          </van-form>

          <van-field v-model="from.interest_rate" name="借款利率" label="借款利率" placeholder="借款利率"
            :rules="[{ required: true, message: '请填写借款利率' }]" />

          <van-dropdown-menu>
            <van-dropdown-item v-model="from.term" :options="option2" />
          </van-dropdown-menu>

          <van-dropdown-menu>
            <van-dropdown-item v-model="from.pay_type" :options="option1" />
          </van-dropdown-menu>
          <van-button @click="toubiao">确认投标</van-button>
        </van-col>
        <van-col span="8"></van-col>
      </van-row>
    </div>

</div>
</template>

<script>
export default {
  data() {
    return {
      tmoney: 2000,
      from: {
        userid: localStorage.getItem('userid'),
        purpose: "",
        descrip: "",
        pay_type: 0,
        term: 0,
        interest_rate: 0,
      },

      option1: [
        { text: '请选择还款方式', value: 0 },
        { text: '自动还款', value: 1 },
        { text: '手动还款', value: 2 },
      ],
      option2: [
        { text: '请选择还款日期', value: 0 },
        { text: '一月', value: 1 },
        { text: '二月', value: 2 },
        { text: '三月', value: 3 },
        { text: '四月', value: 4 },
        { text: '五月', value: 5 },
        { text: '六月', value: 6 },
        { text: '七月', value: 7 },
        { text: '八月', value: 8 },
        { text: '九月', value: 9 },
        { text: '十月', value: 10 },
        { text: '十一月', value: 11 },
        { text: '十二月', value: 12 },
      ],

    };
  },
  methods: {
    toubiao() {
      this.axios.post('addbiaodi', this.from).then(res => {
        console.log(res)
        if (res.data.code == 200) {
          alert(res.data.msg)
        }
      })
    }
  },
  mounted() { },
};
</script>

<style></style>